 public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
        //子问题思路，先根再递归左子树和右子树
        if(root == null) return null;
        
        if(root == q || root == p){
            return root;
        }
        
        TreeNode left = lowestCommonAncestor(root.left,p,q);
        TreeNode right = lowestCommonAncestor(root.right,p,q);
        
        if(left != null && right != null){
            return root;
        }
        if(left == null){
            return right;
        }
        if(right == null){
            return left;
        }
        return null;
    }